var yAxisMin = null;
		var showValue = true;
		var animation = false

		function bar(title1, legends, labels, datas ) {
			var dataset = [];
			for (var i = 0; i < datas.length; i++) {
				var temp = {};
				temp.name = legends[i];
				temp.type = 'bar';
				temp.data = datas[i];
				dataset.push(temp)
			}
			var option = {
				animation: animation,
				title: {
					text: title1,
					left: 'center'
				},
				legend: {
					data: legends,
					top: '3%'
				},
				label: {
					show: true,
					position: 'top'
				},
				xAxis: {
					type: 'category',
					data: labels
				},
				yAxis: {
					type: 'value',
					min: yAxisMin
				},
				series: dataset
			};
			myChart.setOption(option)
		}

		function line(title1, legends, labels, datas, smooth) {
			var dataset = [];
			for (var i = 0; i < datas.length; i++) {
				var temp = {};
				temp.name = legends[i];
				temp.type = 'line';
				temp.smooth = smooth;
				temp.data = datas[i];
				dataset.push(temp)
			}
			var option = {
				animation: animation,
				title: {
					text: title1,
					left: 'center'
				},
				legend: {
					data: legends,
					top: '3%'
				},
				label: {
					show: showValue,
					position: 'top'
				},
				xAxis: {
					type: 'category',
					data: labels
				},
				yAxis: {
					type: 'value',
					min: yAxisMin
					
				},
				series: dataset
			};
			myChart.setOption(option)
		}

		function pie(title, labels, datas, isRing) {
			var dataset = [];
			var temp = {};
			if(isRing){
				temp.radius = ['33%','60%'];
			}else{
				temp.radius = '60%';
			}
			
			temp.type = 'pie';
			temp.data = [];
			for (var j = 0; j < datas.length; j++) {
				var obj = {};
				obj.value = datas[j];
				obj.name = labels[j];
				temp.data.push(obj)
			}
			temp.label = {
				show: showValue,
				formatter: '{b}({c})'
			};
			dataset.push(temp);
			var option = {
				animation: animation,
				title: {
					text: title,
					left: 'center'
				},
				legend: {
					top: '3%'
				},
				tooltip: {
					trigger: 'item'
				},
				series: dataset
			};
			myChart.setOption(option)
		}

		function gauge(startAngle, endAngle, min, max, data) {
			var option = {
				animation: animation,
				series: [{
					type: 'gauge',
					startAngle: startAngle,
					endAngle: endAngle,
					min: min,
					max: max,
					data: [{
						value: data
					}]
				}]
			};
			myChart.setOption(option)
		}
		
		function setTheme(theme){
			document.getElementById("theme").src = theme+".js";
			myChart = echarts.init(dom,theme);
		}


		function getDataURL() {
			var str = myChart.getDataURL();
			console.log(str);
			if (typeof ECHARTS != 'undefined') {
				ECHARTS.getDataURL(str)
			}
		}
		myChart.on('click', function(params) {
			console.log(params.seriesName, params.name, params.value);
			if (typeof ECHARTS != 'undefined') {
				ECHARTS.clicked(params.seriesName, params.name, params.value)
			}
		});